﻿@{
    int pageCount = ViewBag.DataCount / ViewBag.PageSize + 1;

    int currentPage = ViewBag.CurrentPage;
}
<div class="pagination">
    <span class="first_page"><a href="/"></a></span>
    @for (var i = 1; i <= pageCount; i++)
    {
        if (i == currentPage)
        {
        <span class="page_num current_page"><a href="/page/@i">@i</a> </span>
        }
        else
        {
        <span class="page_num"><a href="/page/@i">@i</a> </span>
        }
    }
    @if (currentPage == pageCount)
    {
        <span class="next_page"><a href="/page/@pageCount">Next</a> </span>
    }
    else
    {
        <span class="next_page"><a href="/page/@(pageCount + 1)">Next</a> </span>
    }
</div>
